<?php

namespace Biz\Resources\Site;

use Lumen\Http\Resources\Json\Resource;
use Biz\Constants\Site\SiteMailConstants;

/**
 * SiteMailResource.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class SiteMailResource extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function toArray($request)
    {
        return [
            'uid'         => $this->uid,
            'driver'      => $this->driver,
            'host'        => $this->host,
            'port'        => $this->port,
            'from'        => $this->from,
            'encryption'  => $this->encryption,
            'username'    => $this->username,
            'password'    => $this->password,
            'sendmail'    => $this->sendmail,
            'status'      => $this->status,
            'status_name' => SiteMailConstants::$StatusNames[$this->status],
            'created_at'  => $this->created_at->getTimestamp(),
        ];
    }
}
